
from flask import Flask, request, jsonify
from LLM import llm_predict


app = Flask(__name__)


@app.route('/predict', methods=['POST'])
def predict():
    # 获取用户请求中的数据
    data = request.get_json()
    print(f'data: {data}, {type(data)}')        # 字典
    # 调用预测函数
    result = llm_predict(data["input_text"])
    # 返回结果
    return jsonify(result)


# todo 3. 启动App应用
if __name__ == '__main__':
    # app.run(host='0.0.0.0', port=10086, debug=True)
    app.run(host='192.168.109.34', port=10086, debug=True)